<include file="Public:header"/>

<section class="bd bd_p0">		
	<div class="form_user">
		<p class="tips">请填写注册时所用的手机号：</p>
		<div class="row">
			<span class="icon icon_mobile">&nbsp;</span>
			<input type="text" name="mobile" value="" placeholder="填写手机号" class="text" />
		</div>
		<div class="row row_code">
			<span class="icon icon_code">&nbsp;</span>
			<input type="text" name="imgcode" value="" placeholder="请输入验证码" class="text" />
			<a href="javascript:;" class="noneAjax">
				<img class="img-verify" href="{:U('Login/imgcode', 'w=126&h=38')}" src="{:U('Login/imgcode', 'w=126&h=38')}" />
			</a>
		</div>
		<div class="code_enter">
			<input type="text" name="smscode" value="" placeholder="请输入短信验证码" class="text" />
			<a class="nojump get-smscode">获取验证码</a>
			<a class="nojump smscode-time" style="display: none"><span>60</span>s</a>
		</div>
		<div class="row">
			<span class="icon icon_psw">&nbsp;</span>
			<input type="password" name="password" value="" placeholder="设置密码" class="text" />
		</div>
		<div class="row">
			<span class="icon icon_psw">&nbsp;</span>
			<input type="password" name="repassword" value="" placeholder="确定密码" class="text" />
		</div>
		<div class="submit">
			<input type="button" name="" value="找回密码" class="btn" />
		</div>
	</div>
</section>
<style type="text/css">
.main{
	background-color: #FFF;
}
</style>

<script type="text/javascript">
$(document).ready(function() {
	$('.img-verify').click(function () {
		var url = $(this).attr('href') + '?' + Math.random();
		$(this).attr('src', url);
		return false;
	});
	//获取验证码
	$('.get-smscode').click(function () {
		var mobile  = $('input[name="mobile"]').val();
		var imgcode = $('input[name="imgcode"]').val();
		if(!mobile){
			msgbox('手机号不能为空！', 'error');
			return false;
		}
		if(!imgcode){
			msgbox('图片验证码不能为空！', 'error');
			return false;
		}
		loading('获取验证码中...');
		$.ajax({
			type: "get",
			url: "{:U('get_smscode')}",
			data: 'type=forget_password&mobile=' + mobile + '&imgcode=' + imgcode,
			dataType: "json",
			success: function(data){
				removeLoading();
				if(data.status == 1){
					$('.get-smscode').hide();
					$('.smscode-time').css('display', 'inline-block').find('span').text(60);
					msgbox(data.info);
					var wait = $('.smscode-time span');
					var smscode_interval = setInterval(function(){
						var time = wait.text();
							--time;
							wait.text(time);
						if(time == 0) {
							$('.smscode-time').hide();
							$('.get-smscode').show();
							clearInterval(smscode_interval);
						};
					}, 1000);
				}else{
					msgbox(data.info, 'error');
				}
			},
			error : function () {
				removeLoading();
				msgbox('请求失败！', 'error');
			}
		});
	});
});
</script>

<include file="Public:footer"/>